package com.chennan.javabase.domain.map;

import com.chennan.javabase.domain.map.modal.Mall;
import com.chennan.javabase.domain.map.modal.Product;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author chennan
 * @createTime 2021年07月26日 10:55:00
 */
@Service
public class ToMap {

//    private static Map<BigDecimal, Mall> malls = new HashMap<>();
//    private static List<String> mallNames = Arrays.asList(new String[]{"朝阳大悦城", "西单大商场", "东单大商场", "南站大商场", "沙岭子大商场", "牛逼大商场"});
//    static {
//        Map<String, Mall> collect = mallNames.stream().collect(Collectors.toMap(item -> item, a -> {
//            String location = a.substring(0, a.length() - 4);
//            Mall mall = new Mall();
//            // mall.setId(1);
//            return mall;
//        }, (b, c) -> {
//            return b;
//        }));
//    }

    public List<Product> getProducts(int n){
        List<Product> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Product product = new Product();
            product.setBrand("测试品牌"+i);
            product.setName("测试商品"+i);
            product.setMallId(new BigDecimal(i));
            product.setId(new BigDecimal(i));
            list.add(product);
        }
        return list;
    }

}



